package com.biubiu.rotationchart;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageSwitcher;
import android.widget.ImageView;
import android.widget.ViewSwitcher;

public class MyImageView extends ImageSwitcher implements ViewSwitcher.ViewFactory {
    public MyImageView(Context context) {
        super(context);
        setFactory(this);
    }

    public MyImageView(Context context, AttributeSet attrs) {
        super(context, attrs);
        setFactory(this);
    }

    @Override
    public View makeView() {
        ImageView imageView = new ImageView(this.getContext());
        imageView.setLayoutParams(new LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        imageView.setBackgroundColor(Color.TRANSPARENT);
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        return imageView;
    }
}
